<#assign ctx=springMacroRequestContext.contextPath />
<#include "/macro/simple.ftl">

<@header title="IM管理后台">
    <link href="${ctx}/resource/common/css/signin.css" rel="stylesheet">

    <style>
        .error-pane {
            position: relative;
            color: #ff2117;
            background-color: #cce5ff;
            border-color: #b8daff;
            padding: 10px;
            width: 100%;
            border-radius: 5px;
            margin-bottom: 10px;
        }
    </style>

    <script>
        function refreshValidateCode() {
            $("#validateImage").attr("src", "${ctx}/caprica?=" + new Date());
        }
    </script>
</@header>

<@body>
    <div class="container form-signin">
        <h1 class="h3 mb-3 font-weight-normal">IM管理后台</h1>

        <#if error?? || param.error?? || org.springframework.validation.BindingResult.exception??>
            <div class="error-pane">
                ${error!} ${param.error!} ${org.springframework.validation.BindingResult.exception!}
            </div>
        </#if>

        <#if RequestParameters.error?? || Session.SPRING_SECURITY_LAST_EXCEPTION??>
            <#if Session.SPRING_SECURITY_LAST_EXCEPTION.message == "Bad credentials">
                <div class="error-pane">
                    密码错误
                </div>
            <#elseif Session.SPRING_SECURITY_LAST_EXCEPTION.message == "Bad verifyCode">
                <div class="error-pane">
                    验证码错误
                </div>
            <#else>
                <div class="error-pane">
                    ${Session.SPRING_SECURITY_LAST_EXCEPTION.message}
                </div>
            </#if>
        </#if>

        <form action="${ctx}/login" method="post">
            <div class="form-group">
                <label for="userName" class="sr-only">用户名：</label>
                <input type="text" class="form-control" name="userName" id="userName" autocomplete="off" placeholder="用户名" value="demo" required autofocus/>
            </div>
            <div class="form-group">
                <label for="password" class="sr-only">密码：</label>
                <input type="password" class="form-control" name="password" id="password" value="123456" class="form-control" placeholder="Password" required autocomplete="off"/>
            </div>
            <div class="form-group">
                <label for="validateCode" class="sr-only">验证码：</label>
                <input type="text" class="form-control" name="validateCode" id="validateCode" class="form-control" placeholder="验证码" required autocomplete="off" style="display: inline; max-width: 170px"/>
                <img src="${ctx}/caprica" id="validateImage" onclick="refreshValidateCode()" style="margin-top: -4px"/>
            </div>
            <div class="form-group">
                <label>
                    <input type="checkbox" name="remember-me" value="true"> Remember me
                </label>
            </div>

            <button class="btn btn-lg btn-primary btn-block" type="submit">登录</button>
        </form>
    </div>

    <ul>
        <li><a href="/webrtc/demo">webrtc demo</a></li>
        <li><a href="/webrtc/demo2">webrtc demo2</a></li>
        <li><a href="/webrtc/local">webrtc local</a></li>
        <li><a href="/webrtc/demo4">webrtc demo4</a></li>
        <li><a href="/webrtc/webrtcLocal">webrtc local</a></li>
        <li><a href="/resource/webrtc_hm.html">webrtc hm</a></li>
        <li><a href="/webrtc/webrtc_hm2">webrtc hm2</a></li>
    </ul>
</@body>

<@footer>
</@footer>
